import { useMemberStore } from "../store/modules/member";
const memberStore = useMemberStore()
const token = memberStore.profile
// 基础 URL，根据您的后端配置进行修改

const BASE_URL = 'https:192.168.1.102:4355';

// 封装 POST 请求
export function post(url, data) {
    return new Promise((resolve, reject) => {
      uni.request({
        url: BASE_URL + url,
        method: 'POST',
        data,
        header:{'Content-Type':'application/x-www-form-urlencoded',
        'Authorization': `Bearer ${token?token:''}`},
        success: (res) => {
          if (res.statusCode === 200) {
            resolve(res.data);
          } else {
            reject(res);
          }
        },
        fail: (error) => {
          reject(error);
        },
      });
    });
  }